package com.ruoyi.message.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.message.mapper.MessageZanMapper;
import com.ruoyi.message.domain.MessageZan;
import com.ruoyi.message.service.IMessageZanService;

/**
 * 赞记录Service业务层处理
 * 
 * @author hct
 * @date 2022-04-14
 */
@Service
public class MessageZanServiceImpl implements IMessageZanService 
{
    @Autowired
    private MessageZanMapper messageZanMapper;

    /**
     * 查询赞记录
     * 
     * @param id 赞记录主键
     * @return 赞记录
     */
    @Override
    public MessageZan selectMessageZanById(Long id)
    {
        return messageZanMapper.selectMessageZanById(id);
    }

    /**
     * 查询赞记录列表
     * 
     * @param messageZan 赞记录
     * @return 赞记录
     */
    @Override
    public List<MessageZan> selectMessageZanList(MessageZan messageZan)
    {
        return messageZanMapper.selectMessageZanList(messageZan);
    }

    /**
     * 新增赞记录
     * 
     * @param messageZan 赞记录
     * @return 结果
     */
    @Override
    public int insertMessageZan(MessageZan messageZan)
    {
        return messageZanMapper.insertMessageZan(messageZan);
    }

    /**
     * 修改赞记录
     * 
     * @param messageZan 赞记录
     * @return 结果
     */
    @Override
    public int updateMessageZan(MessageZan messageZan)
    {
        return messageZanMapper.updateMessageZan(messageZan);
    }

    /**
     * 批量删除赞记录
     * 
     * @param ids 需要删除的赞记录主键
     * @return 结果
     */
    @Override
    public int deleteMessageZanByIds(Long[] ids)
    {
        return messageZanMapper.deleteMessageZanByIds(ids);
    }

    /**
     * 删除赞记录信息
     * 
     * @param id 赞记录主键
     * @return 结果
     */
    @Override
    public int deleteMessageZanById(Long id)
    {
        return messageZanMapper.deleteMessageZanById(id);
    }

    @Override
    public int getByMemberIdAndMessageId(Long memberId,Long messageId){
        return messageZanMapper.getByMemberIdAndMessageId(memberId,messageId);
    }

    @Override
    public void delMemberIdAndMessageId(Long memberId, Long messageId) {
        boolean isOk=false;
        try{
            messageZanMapper.delMemberIdAndMessageId(memberId,messageId);
            isOk=true;
        }catch(Exception e){

        }
    }
}
